package com.woniuxy.stage3demo.controller.gy;

import com.woniuxy.stage3demo.bean.caicai.UserInfoBean;
import com.woniuxy.stage3demo.bean.gy.CollectionLogBean;
import com.woniuxy.stage3demo.bean.gy.DetailsUtil;
import com.woniuxy.stage3demo.bean.hpxbean.OrderBean;
import com.woniuxy.stage3demo.service.gy.OverdueCollectionLogService;
import com.woniuxy.stage3demo.service.gy.OverdueOrderService;
import com.woniuxy.stage3demo.service.gy.OverdueUserInfoService;
import com.woniuxy.stage3demo.service.gy.OverdueUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

/**催收页面
 * @author ：苟杨
 * @description：TODO
 * @date ：2020/12/15 11:26
 */
@RequestMapping("/col")
@RestController
public class CollectionController {
    @Resource
    private OverdueOrderService overdueOrderService;
    @Resource
    private OverdueUserInfoService overdueUserInfoService;
    @Resource
    private OverdueUserService overdueUserService;
    @Resource
    private OverdueCollectionLogService overdueCollectionLogService;
    //详情页查询各种信息
    @GetMapping(value ="/jump",produces = {"application/json;charset=utf-8"})
    public DetailsUtil jump(int orderId, int userId, int userfId){
        System.out.println(orderId+"aaaaaaaaaaaaaaaaa");
        System.out.println(orderId+"............"+userId+"......"+userfId);
        //查询订单信息
        OrderBean orderBean = overdueOrderService.findById(orderId);
        System.out.println(orderBean);
        //查询用户基本信息
        UserInfoBean userInfoBean = overdueUserInfoService.findItById(userfId);
        System.out.println(userInfoBean);
        //查询配偶基本信息
        UserInfoBean userInfoBean1 = overdueUserService.findSpouseById(userId);
        System.out.println(userInfoBean1);
        //根据订单查询担保人基本信息(1个订单1个保证人)
        OrderBean orderBean1 = overdueUserService.findGuaranteeById(orderId);
        System.out.println(orderBean1);
        //根据订单查询历史催收信息
        List<CollectionLogBean> all =overdueCollectionLogService.findAll(orderId);
        System.out.println(all);
        DetailsUtil du = new DetailsUtil();
        du.setOrderBean(orderBean);
        du.setAll(all);
        du.setOrderBean1(orderBean1);
        du.setUserInforBean1(userInfoBean);
        du.setUserInforBean2(userInfoBean1);
        System.out.println(du);
        return du;
    }
}
